<div id="readNoticeModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="readNoticeModalLabel" aria-hidden="true" style="display: none;">
                                    <div class="modal-dialog" style="width:75%;">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button type="button" class="close readNotice readNoticeBtn" data-dismiss="modal"  note-id="" aria-hidden="true">×</button>
                                                <h4 class="modal-title" id="readNoticeModalTitle"></h4>
                                            </div>
                                            <div class="modal-body" id="readNoticeModalContent">

                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-primary readNotice readNoticeBtn"  data-dismiss="modal" note-id="">关闭</button>
                                            </div>
                                        </div><!-- /.modal-content -->
                                    </div><!-- /.modal-dialog -->
                                </div><!-- /.modal -->


<script>
    $('.readNotice').click(function(){
            var nid = $(this).attr('note-id');
            //alert(nid);
            $.post('/ajax/readnotice/',{'id':nid},function(data) {
                    //swal("已经阅读");
                });
        });
    $('.noticeDetail').click(function(){
            var nid = $(this).attr('note-id');
            //alert(nid);
            $.getJSON('/ajax/getnotice/',{'id':nid},function(data) {
                    //swal("已经阅读");
                //console.log(data["title"]);
                if("title" in data){
                    $('#readNoticeModalTitle').html(data["title"]);
                    $('#readNoticeModalContent').html(data["content"]);
                    $('.readNoticeBtn').attr('note-id',data["id"]);
                }

                });
        });

    //关键词搜索
    $('.doSearch').click(function(){
        var key = $('#key').val();
        if(key.length<=0){
             alert('请填关键词');
             $('#key').focus();
             return false;
         }else{
            location.href = "{% url 'search' %}?key="+key;
        }
    });

</script>